<?php
declare (strict_types = 1);

namespace app\ldblf_forum\validate;

use think\Validate;

class LogUser extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'code|验证码'               =>           'require|captcha',
        'unick|用户名'              =>           'require|length:2,10',
        'pwd|密码'                  =>          'require|length:6,16',
        'pwd2|确认密码'             =>          'require|confirm:pwd',
        'email|邮箱地址'            =>          'require|email',
        'tel|电话号码'              =>          'require|mobile'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'unick.length'           =>          '用户名长度限制是2~10个字符',
        'pwd.length'            =>          '密码的长度限制是6~16个字符',
        'pwd2.length'           =>          '两次密码输入不一致！',
        'email'                 =>          '邮箱地址的格式不正确！',
        'tel'                   =>          '手机号码格式不正确！',
        'code'                  =>          '验证码格式不正确！'
    ];

    /**
     * 定义验证场景
     * 格式：'场景名' =>  ['字段名1','字段名2']
     */
    protected $scene = [
        'register'      =>      ['unick','pwd','pwd2','email','tel','code']
    ];
}
